// signal_restart.c
#include <signal.h>
#include <unistd.h>
#include <stdio.h>

void sigHandler(int signum) {
    printf("Received signal: %d\n", signum);
}

int main() {
    struct sigaction act;
    sigemptyset(&act.sa_mask);
    act.sa_handler = sigHandler;
    act.sa_flags = SA_RESTART;
    sigaction(SIGUSR1, &act, NULL);
    while (1) {
        sleep(1);
        printf("Waiting for signal...\n");
    }
    return 0;
}
